const mysql = require("mysql")
const config = require('./config.js')
let pool = mysql.createPool(config.data);

function dml(sql,param){
    return new Promise((resolve,reject)=>{
        pool.getConnection((err,con)=>{
            if(err){
                console.log("数据库连接失败",err)
            }else{
                con.query(sql,param,(err,rows)=>{
                    if(err){
                        reject(err);
                    }else{
                       resolve(rows);
                    }
                    con.release();
                });
               
            }
        });
    });
    
    
}
exports.dml=dml



